package application.controller;

import application.ATM;
import application.ATMFrame;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TextField;

import java.io.IOException;

public class DepositController {
    Parent tp;
    @FXML
    private TextField amount;
    public void setOneHundredAction(){
        amount.setText("100");
    }
    public void setThreeHundredAction(){
        amount.setText("300");
    }
    public void setFiveHundredAction(){
        amount.setText("500");
    }
    public void setOneThousandAction(){
        amount.setText("1000");
    }
    public void setThreeThousandAction(){
        amount.setText("3000");
    }
    public void setFiveThousandAction(){
        amount.setText("5000");
    }
    public void Back() {
        try {
            tp = FXMLLoader.load(getClass()
                    .getResource("../fxml/Main.fxml"));
            Scene tpScene = new Scene(tp);
            ATMFrame.stage.setScene(tpScene);

        } catch (IOException e1) {
            System.out.println("执行出错");
            e1.printStackTrace();
        }
    }
    public void Submit() {
        int a=Integer.parseInt(amount.getText());
        ATM.askForTransaction(a);
            try {
                tp = FXMLLoader.load(getClass()
                        .getResource("../fxml/Success.fxml"));
                Scene tpScene = new Scene(tp);
                ATMFrame.stage.setScene(tpScene);

            } catch (IOException e1) {
                System.out.println("执行出错");
                e1.printStackTrace();
            }
    }
}
